/*
 *  顺子日期
 * */

#include <iostream>

using namespace std;

int main() {

    int count = 0, day;

    for (int month = 1; month <= 12; ++month) {
        if (month == 2) {
            day = 28;
        } else if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
            day = 31;
        } else {
            day = 30;
        }

        for (int i = 1; i <= day; ++i) {
            if ((month / 10 == month % 10 - 1 && month % 10 == i / 10 - 1) ||
                (month % 10 == i / 10 - 1 && i / 10 == i % 10 - 1)) {
                count++;
            }
        }
    }

    cout << count;

    return 0;
}